from pyglons import app, config
from pyglons.base_app import App
from brick.load_config import load_config
from brick.states import BrickSplashState, BrickMenuState

import pyglet

class BrickApp(App):

    def __init__(self):
        App.__init__(self)

        self.configfile = load_config()

        self.init_video()

        if config['debug']['events']:
            self.window.push_handlers(pyglet.window.event.WindowEventLogger())

        initial_stack = [BrickMenuState()]

        if not config['debug']['skip_splash']:
            initial_stack.append(BrickSplashState())

        self.pushMany(initial_stack)


def main():
    BrickApp()
    app.run()



